<?php

class Story_Form_Create_Invite extends Engine_Form
{
	
	private $_story_id;
	
	public function setStory($story_id){
		$this->_story_id = $story_id;
	}
	
	public function getStory(){
		return $this->_story_id;
	}

    public function init()
    {
    	
    	$this->setDescription("Welcome to story thread. No need to write story alone. Now you can invite your friends to write it with you.");
        $user = Engine_Api::_()->user()->getViewer();
        $user_level = Engine_Api::_()->user()->getViewer()->level_id;
        
        $this->addElement('Radio', 'friend_id', array(
        		'label' => 'Invite Friend',
        ));
       
        
        $this->addElement('Textarea', 'message', array(
        		'label' => 'Message',
        ));
        $this->message->getDecorator("Description")->setOption("placement", "prepend");
        $this->addElement('Hidden', 'story_id', array('order' => '12'));
        $this->story_id->setValue($this->_story_id);
        
        $this->addElement('button', 'submit', array(
        		'label' => 'Send Invitation',
        		'type' => 'submit',
        		'value' => 'save',
        		'ignore' => true,
        		'decorators' => array('ViewHelper')
        ));
        
        
        $this->addElement('Cancel', 'cancel', array(
        		'label' => 'cancel',
        		'link' => true,
        		'prependText' => ' or ',
        		'decorators' => array(
        				'ViewHelper'
        		)
        ));
        
        $this->addDisplayGroup(array('submit', 'cancel'), 'buttons');      
        
        
        $button_group = $this->getDisplayGroup('buttons');
        $button_group->addDecorator('DivDivDivWrapper');
        
        $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array('action'=>'invite', 'story_id' => $this->_story_id),'story_general',true));

    }

}
